<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
    *{margin: 0;padding: 0;}
    #main{
        width: 200px;
        height: 200px;
        padding: 100px;
        margin: 100px;
        border: 5px solid #ccc;
        background: blue;
        color: aqua;
        font-size: 50px;
        overflow: scroll;
    }
    </style>
</head>
<body>
<div id="main">11112345678940397632
    45678900987654356789098765
    45678900987654356789098765
    45678900987654356789098765
    45678900987654356789098765
</div>    
<script>
var main=document.getElementById('main');
//main是节点对象  style css对象   background 属性名  red是值
//main.style.background='yellow';
//console.log(main.style.background);
console.log(getComputedStyle(main,null).background);
console.log(getComputedStyle(main,null).width);
console.log(getComputedStyle(main,null).color);
console.log(getComputedStyle(main,null).fontSize);
console.log(main.offsetWidth);
console.log(main.clientWidth);
console.log(main.offsetLeft);
document.onclick=function(){
    alert(main.scrollLeft);
}

</script>
</body>
</html>